#include <bits/stdc++.h>
#define pow fastpow
#define swap my_swap

template <typename T>
void my_swap(T &x, T &y) {
    return x ^= y ^= x ^= y, void();
}

const int N = 3e6 + 10; const int P = 998244353, G = 3, Gi = 332748118;
typedef long long ll;

int l, r[N], limit = 1; ll a[N], b[N]; int n, m;

ll fastpow(ll a, ll b) {
    ll res = 1, base = a;
    for (; b; b >>= 1) {
        if (b & 1) res = (res * base) % P;
        base = (base * base) % P;
    }
    return res % P;
}

void NTT(ll A[], int type) {
    for (int i = 0; i < limit; i++)
        if (i < r[i]) swap(A[i], A[r[i]]);
    for (int mid = 1; mid < limit; mid <<= 1) {
        ll Wn = pow(type == 1 ? G : Gi, (P - 1) / (mid << 1));
        for (int R = mid << 1, j = 0; j < limit; j += R) {
            ll w = 1;
            for (int k = 0; k < mid; k++, w = (w * Wn) % P) {
                ll x = A[j + k], y = w * A[j + mid + k] % P;
                A[j + k] = (x + y) % P; A[j + mid + k] = (x - y + P) % P;
            }
        }
    }
    return;
}

int main() {
    std::cin >> n >> m;
    for (int i = 0; i <= n; i++) std::cin >> a[i];
    for (int i = 0; i <= m; i++) std::cin >> b[i];
    while (limit <= n + m) limit <<= 1, l++;
    for (int i = 0; i < limit; i++) r[i] = r[i >> 1] >> 1 | (i & 1) << l - 1;
    NTT(a, 1); NTT(b, 1); for (int i = 0; i < limit; i++) a[i] = (a[i] * b[i]) % P;
    NTT(a, -1); int INV = pow(limit, P - 2); for (int i = 0; i <= n + m; i++) std::cout << (a[i] * INV) % P << ' ';
    return std::cout << std::endl, 0;
}
//快速傅里叶变换模板